package 考试;

import java.util.*;

public class xueshengTest {
        public static void main(String[] args) {
            Map<String, Integer> map = new HashMap<>();
            map.put("z1", 70);
            map.put("z2", 60);
            map.put("z3", 100);
            map.put("z4", 61);
            map.put("z5", 80);
            map.put("z6", 66);
            map.put("z7", 70);
            map.put("z8", 88);
            List<Map.Entry<String, Integer>> list = new ArrayList<>(map.entrySet());
            Collections.sort(list, new Comparator<Map.Entry<String, Integer>>() {
                @Override
                public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) {
                    int value1 = Integer.valueOf(o1.getValue());
                    int value2 = Integer.valueOf(o2.getValue());
                    if (value1 < value2) {
                        return 1;
                    } else if (value1 > value2) {
                        return -1;
                    } else {
                        return 0;
                    }
                }
            });
            System.out.println(list);
        }
}
